var _hmt = _hmt || [];
(async function () {
  let tongjiArray = [];
  await fetch("/api/configuration/tongji/baidu")
    .then((response) => response.json())
    .then((result) => {
      tongjiArray = result.data;
    });
  for (const item of tongjiArray) {
    if (!item.domain || !item.code) continue;
    if (window.location.href.includes(item.domain)) {
      var hm = document.createElement("script");
      hm.src = `https://hm.baidu.com/hm.js?${item.code}`;
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
      break;
    }
  }
})();
